

def isPrime(num):
    import math
    for i in range(2,int(math.sqrt(num))+1):
        if num % i == 0:
            return False
    return True

def primeGenerator():
    yield 2
    yield 3
    start = 3
    while 1:
        start += 2
        if isPrime( start ):
            yield start
def main():
    index = 10000
    for i,key in enumerate(primeGenerator()):
        if i == index:
            return i,key

import time
t1 = time.time()
i,key = main()
t2 = time.time()
print 'the %d prime int is %d.' % (i,key)
print 'toke %s (s) time.' % str(t2-t1)
